# -*- coding: utf-8 -*-
# @Time: 2021/8/25 8:27
# @File: arg-20-1.py
# @DESC:


def isValid(s: str) -> bool:
    dict = {
        "(": ")",
        "{": "}",
        "[": "]"
    }
    stack = list()
    lent = len(s)
    for i in range(lent):
        temp = s[i]
        if temp in dict:
            stack.append(s[i])
        elif len(stack) < 1 or dict[stack[-1]] != s[i]:
            return False
        else:
            stack.pop()
    return len(stack) == 0


s = "){"
# s = "()[]{}"

r = isValid(s)

print(r)
